package com.leyou.httpdemo.utils;

/**
 * 关键字pdf位置记录类
 *
 * @author raos
 * @date 2024-03-26 22:50
 */
public class PdfPosition {

    private int page;
    private float xStart;
    private float yStart;
    private float xEnd;
    private float yEnd;

    public PdfPosition(int page, float xStart, float yStart, float xEnd, float yEnd) {
        this.page = page;
        this.xStart = xStart;
        this.yStart = yStart;
        this.xEnd = xEnd;
        this.yEnd = yEnd;
    }

    public int getPage() {
        return page;
    }

    public float getXStart() {
        return xStart;
    }

    public float getYStart() {
        return yStart;
    }

    public float getXEnd() {
        return xEnd;
    }

    public float getYEnd() {
        return yEnd;
    }

    // 为了简化示例，这里只提供x和y的平均位置作为参考点
    public float getXDirAdj() {
        return (xStart + xEnd) / 2;
    }

    public float getYDirAdj() {
        return (yStart + yEnd) / 2;
    }

    @Override
    public String toString() {
        return "PdfPosition{" +
                "page=" + page +
                ", xStart=" + xStart +
                ", yStart=" + yStart +
                ", xEnd=" + xEnd +
                ", yEnd=" + yEnd +
                '}';
    }
}
